package gazzera.swing.browse;

import gazzera.swing.utility.*;

import java.awt.*;

import javax.swing.*;
import javax.swing.table.*;


public class FileIconRenderer extends JLabel implements TableCellRenderer
{


	
    public FileIconRenderer() {
    	setHorizontalAlignment(SwingConstants.CENTER);
    }

    public Component getTableCellRendererComponent(
            JTable table, Object o,
            boolean isSelected, boolean hasFocus,
            int row, int column) {
    	
        RemoteFile f = (RemoteFile)o;
        String filename = f.name;
        String extension =  (filename.lastIndexOf(".")==-1)?"":filename.substring(filename.lastIndexOf(".")+1,filename.length());

		Icon i = Utils.getSystemIcon(extension);

		setIcon(i);
       

        return this;
    }

}